---
title: "Standalone Database"
description: Connect your CLI to a self-hosted Hot Updater server.
icon: Server
---

## Overview

The `standaloneRepository` plugin connects your Hot Updater CLI to a self-hosted backend server. This is the **client-side configuration** for connecting to your server.

<Callout type="info">
**Building a Self-Hosted Server?**

See the [Self-Hosting (Custom) Guide](../custom/overview) for complete server implementation instructions using `@hot-updater/server` with database adapters (Drizzle, Prisma, Kysely, MongoDB) and frameworks (Hono, Express, Elysia).
</Callout>

## Installation

```package-install
npm install @hot-updater/standalone --save-dev
```

## Usage

Configure your CLI to connect to your self-hosted server:

```typescript title="hot-updater.config.ts"
import { defineConfig } from "@hot-updater/core";
import { standaloneRepository } from "@hot-updater/standalone";

export default defineConfig({
  build: /* your build plugin */,
  storage: /* your storage plugin */,
  database: standaloneRepository({
    baseUrl: "http://localhost:3000/hot-updater",
  }),
});
```

## Configuration

The `standaloneRepository` plugin accepts the following options:

```typescript
interface StandaloneRepositoryConfig {
  baseUrl: string;                        // Your server URL
  commonHeaders?: Record<string, string>; // Optional headers (e.g., authentication)
  routes?: Routes;                        // Optional custom route configuration
}
```

### Basic Example

```typescript
database: standaloneRepository({
  baseUrl: "http://localhost:3000/hot-updater",
})
```

### With Authentication

```typescript
database: standaloneRepository({
  baseUrl: process.env.HOT_UPDATER_SERVER_URL!,
  commonHeaders: {
    "Authorization": `Bearer ${process.env.API_TOKEN}`
  }
})
```

### With Custom Routes

```typescript
database: standaloneRepository({
  baseUrl: "https://api.example.com",
  routes: {
    upsert: () => ({
      path: "/v1/hot-updater/api/bundles",
      headers: { "X-Custom-Header": "value" }
    }),
    list: () => ({
      path: "/v1/hot-updater/api/bundles"
    }),
    retrieve: (bundleId) => ({
      path: `/v1/hot-updater/api/bundles/${bundleId}`
    }),
    delete: (bundleId) => ({
      path: `/v1/hot-updater/api/bundles/${bundleId}`
    })
  }
})
```

## Next Steps

- [CLI Configuration](../custom/cli-configuration) - Complete CLI configuration guide
- [Self-Hosting (Custom) Overview](../custom/overview) - Learn about the architecture
- [Quick Start Guide](../custom/quick-start) - Set up a server in 5 minutes
- [Database Adapters](../custom/database/drizzle) - Choose your ORM (Drizzle, Prisma, Kysely, MongoDB)
- [Server Frameworks](../custom/frameworks/hono) - Choose your framework (Hono, Express, Elysia)
